export const useShareStore = defineStore("Share", () => {
  type modelAttrsType = {
    title?: String;
    cardAttr?: any;
    componentAttr?: any;
    dialogAttr?: any;
  };
  const visible = ref(false);
  const targetComponent = shallowRef();
  const modelAttrs = ref<modelAttrsType>({
    cardAttr: {},
    componentAttr: {},
  });
  const openModal = (component: any, attrs?: modelAttrsType) => {
    console.log(component, 123133213);

    targetComponent.value = component;
    modelAttrs.value.cardAttr = { ...attrs?.cardAttr };
    modelAttrs.value.componentAttr = attrs?.componentAttr;
    modelAttrs.value.title = attrs?.title;
    modelAttrs.value.dialogAttr = attrs?.dialogAttr;
    visible.value = true;
  };
  return { visible, openModal, targetComponent, modelAttrs };
});
